package TEST;

public class Test2 {

    public static void main(String[] args) {
        String string = "123456789";
        int num = 0;
        if (!string.matches("[1-9]\\d{0,9}")) {
            System.out.println("不是数字");
        } else {
            System.out.println("是数字");
            for (int i = 0; i < string.length(); i++) {
                int c = string.charAt(i) - '0';
                num = num * 10 + c;
            }
        }
        System.out.println(num+1);
    }
}
